package x.y.z;

public class Interview_1_4_PalindromePermutation {
    public boolean canPermutePalindrome(String s) {
        int[] table = new int[128];
        for (int i = 0; i < s.length(); i++) {
            int c = s.charAt(i);
            table[c]++;
        }
        return checkMaxOneOdd(table);
    }

    public boolean checkMaxOneOdd(int[] table) {
        boolean foundOdd = false;
        for (int count : table) {
            if (count % 2 == 1) {
                if (foundOdd) {
                    return false;
                }
                foundOdd = true;
            }
        }
        return true;
    }
}